package com.xiaowei.gym.gymjsp.ware.service.impl;

import com.xiaowei.gym.gymjsp.ware.dao.MemberDao;
import com.xiaowei.gym.gymjsp.ware.dao.impl.MemberDaoImpl;
import com.xiaowei.gym.gymjsp.ware.entity.MemberEntity;
import com.xiaowei.gym.gymjsp.ware.entity.ReservationEntity;
import com.xiaowei.gym.gymjsp.ware.service.MemberService;

import java.util.List;

public class MemberServiceImpl implements MemberService {

    private MemberDao memberDao;

    public MemberServiceImpl() {
        memberDao = new MemberDaoImpl();
    }

    @Override
    public int getCount() {
        int i = memberDao.getCount();
        return i;
    }

    @Override
    public List<MemberEntity> getMemberList(String name, int currentPageNo, Integer pageSize) {
        return memberDao.selectMemberList(name,currentPageNo,pageSize);
    }

    @Override
    public boolean addMember(MemberEntity memberEntity) {
        int i = memberDao.createMember(memberEntity);
        if (i > 0){
            return true;
        }
        return false;
    }

    @Override
    public boolean deleteMemberByIds(Integer[] delId) {
        int[] integers = memberDao.delMemberByIds(delId);
        if (integers.length > 0 || integers !=null){
            return true;
        }
        return false;
    }

    @Override
    public List<MemberEntity> getMemberlAll() {
        return memberDao.getMemberAll();
    }

    @Override
    public MemberEntity getMemberById(Integer valueOf) {
        return memberDao.getById(valueOf);
    }

    @Override
    public boolean modify(MemberEntity memberEntity) {
        int modify = memberDao.modify(memberEntity);
        if (modify > 0){
            return true;
        }

        return false;
    }
}
